<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加商品</title>
</head>
<body>
<div>
  <h1>添加商品</h1>
  <input type="text" v-model="product.title" placeholder="请输入标题">
  <input type="text" v-model="product.price" placeholder="请输入价格">
  <input type="text" v-model="product.saleCount" placeholder="请输入销量">
  <input type="button" value="添加" @click="update()">
</div>

<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>

<script>
  let v = new Vue({
    el:"div",
    data:{
      product:{title:"",price:"",saleCount:""}
    },
    methods:{
      update(){
        axios.post("/update",v.product).then(function (response){
          alert("添加成功!");
          location.href="/product.html";
        })
      }
    }
  })
</script>
</body>
</html>